fix: implement Wayland screen-off in systemTurnOffScreen#89
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deepin-wm The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideImplements the previously missing Wayland/Treeland code path for systemTurnOffScreen by wiring it through Deepin’s Power1 DBus API, wrapping it with suspend-preparation calls, optional lock-before-off behavior, and a small delay to allow the lock UI to render, plus persisting a simple DPMS state marker file. Sequence diagram for updated Wayland systemTurnOffScreen flowsequenceDiagram
participant PowerController
participant DConfig
participant Power1_DBUS as Power1_DBus
participant QFile_dpms as QFile_dpms_state
PowerController->>PowerController: doPrepareSuspend()
PowerController->>DConfig: createPowerConfig(this)
PowerController->>DConfig: shouldLockOnScreenBlack(config)
alt [screenBlackLock]
PowerController->>PowerController: doLock(true)
PowerController->>PowerController: QThread::msleep(500)
end
PowerController->>Power1_DBUS: QDBusInterface(...)
alt [Power1_DBUS isValid]
PowerController->>Power1_DBUS: call(TurnOffScreen)
else [Power1_DBUS invalid]
PowerController->>PowerController: qWarning(...Power1 unavailable...)
end
PowerController->>PowerController: undoPrepareSuspend()
PowerController->>QFile_dpms: open(WriteOnly | Truncate)
alt [open successful]
PowerController->>QFile_dpms: write(1)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
b5f8586 to
d76c15e
Compare
1. Add TurnOffScreenWithLock() DBus method to PowerManager encapsulating lock + delay + DPMS off + state management 2. Simplify powercontroller.cpp Wayland branch to single sessionBus DBus call instead of multi-step client-side flow 3. Use QTimer::singleShot(500) instead of QThread::msleep to avoid blocking the DBus caller thread 4. Manage PrepareSuspend state internally in TurnOffScreenWithLock (PS_Sleeping -> PS_Normal) Log: Fixed power button screen-off not working on Wayland/Treeland Influence: 1. Test power button screen-off in Treeland session 2. Verify lock screen appears before display turns off 3. Test wake from screen-off resumes to lock screen 4. Verify X11 screen-off path is not affected 5. Verify LidSwitchHandler doTurnOffScreen still works fix: 实现 Wayland 熄屏功能 1. 在 PowerManager 中新增 TurnOffScreenWithLock() DBus 方法,封装锁屏+延迟+熄屏+状态管理 2. 简化 powercontroller.cpp Wayland 分支为单次 sessionBus DBus 调用,替代客户端多步编排 3. 使用 QTimer::singleShot(500) 替代 QThread::msleep 避免阻塞 DBus 调用线程 4. PrepareSuspend 状态在 TurnOffScreenWithLock 内部 管理(PS_Sleeping -> PS_Normal) Log: 修复 Wayland/Treeland 下按电源键熄屏无响应的问题 Influence: 1. 在 Treeland 会话下测试按电源键熄屏功能 2. 验证熄屏前锁屏界面正常显示 3. 测试从熄屏唤醒后回到锁屏界面 4. 验证 X11 熄屏路径不受影响 5. 验证合盖熄屏 doTurnOffScreen 仍正常工作 PMS: BUG-209669
d76c15e to
7e4e2ae
Compare
Summary
Replace the TODO placeholder in
systemTurnOffScreen()Wayland branch with a working implementation for Treeland/Wayland.Changes
systemTurnOffScreen()Wayland branchdoPrepareSuspend()/undoPrepareSuspend()to prevent idle watcher raceshouldLockOnScreenBlackis truePower1.TurnOffScreen()via DBus forwlr-output-power-management-v1Flow
Related
PMS: BUG-209669
Issue: WM-50
Summary by Sourcery
Implement Wayland/Treeland screen-off behavior in systemTurnOffScreen using the Power1 DBus interface and suspend preparation hooks.
Bug Fixes:
Enhancements: